package com.andy.customerService.vo;

import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;

@Data
@JsonInclude(JsonInclude.Include.NON_NULL)
public class JsonPageResult<T> extends JsonBaseResult<T>{

    private Integer totalPage;
    private Integer pageNo;
    private Integer pageSize;
    private Integer totalNum;
    private Integer startNum;

    /**
     * 获取总页数
     * @return
     */
    public Integer getTotalPage() {
        if(getTotalNum() == null || getPageSize() == null){
            return null;
        }
        totalPage = getTotalNum() / getPageSize();
        return (totalNum % pageSize == 0) ? totalPage : totalPage + 1;
    }


}
